#ifndef _PARTHUS_UT_ATS_UPPER_TESTER_H
#define _PARTHUS_UT_ATS_UPPER_TESTER_H
/*************************************************************************
 * MODULE NAME:    ut_ats_upper_tester.h
 * PROJECT CODE:    BlueStream
 * DESCRIPTION:    Upper Tester Functions for the abstract test suite
 * MAINTAINER:     John Nelson
 * DATE:           1 Feb 2001
 *
 * SOURCE CONTROL: $Id: ut_ats_upper_tester.h,v 1.1 2008/02/03 09:39:25 james Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2001-2004 Ceva Inc.
 *     All rights reserved.
 *
 * REVISION HISTORY:
 *    V1.0     01 Feb  2001 -   jn     - Initial Version
 *
 * SOURCE: Based on Abstract Test Suites TP V0.9
 * ISSUES:
 *
 *************************************************************************/
#include "lc_types.h"

#define NO_SCANS            0x00
#define INQUIRY_NOPAGE_SCAN 0x01
#define PAGE_NOINQUIRY_SCAN 0x02
#define PAGE_INQUIRY_SCAN   0x03

/*
 * Module Management: Initialise
 */
void UTut_Initialise(void);

/*****************************************************************************
 * UTut_Select_HCI_Transport
 * UTut_Get_HCI_Transport
 *
 * tra_type   HCI transport type
 *            e.g. TRA_HCIT_TYPE_GENERIC, TRA_HCIT_TYPE_UART, TRA_HCIT_TYPE_USB
 *****************************************************************************/
void UTut_Select_HCI_Transport(u_int8 tra_type);
u_int8 UTut_Get_HCI_Transport(void);

/*
 * Connection setup/release to the specified lower tester
 */
/**************************************************************************
 * UTut_Create_Baseband_Connection
 *
 * Setup a valid baseband only connection to the remote slave device via
 *    HCI_Create_Connection Command
 *    (BD_ADDR, Packet_Type, Page_Scan_Repetition_Mode, Page_Scan_Mode,
 *           Clock_Offset, Allow_Role_Switch, HCI_Create_Connection)
 *
 * Returns the connection handle if successful, aborts if not successful.
 *
 * This interface only uses basic types.
 *************************************************************************/
u_int16 UTut_Create_Baseband_Connection(
        const u_int8 bd_addr[6], u_int16 packet_types,
        u_int8 PSR_Mode, u_int8 PS_Mode,
        u_int32 slave_clock_offset_ticks, u_int8 allow_role_switch);

/*****************************************************************************
 *  Function:   UTut_Create_Connection_Pre_Setup_Complete    
 *              IUT Master
 *
 *  Creates an ACL connection to given bd_addr stopping before the
 *  setup complete messages are exchanged to allow further 
 *  connection setup LMP signalling.
 *  Supports multi-point connection setup.
 *
 *  Returns the connection handle if successful, aborts if not successful.
 *****************************************************************************/
u_int16 UTut_Create_Connection_Pre_Setup_Complete(
    const u_int8 bd_addr[6], u_int16 packet_types,
    u_int8 page_scan_repetition_mode, u_int8 page_scan_mode,
    u_int32 slave_clock_offset_ticks, u_int8 allow_role_switch);

/*****************************************************************************
 *  Function:   UTut_Create_Connection    
 *              IUT Master
 *
 *  Creates and completes an ACL connection to given bd_addr
 *  Supports multi-point connection setup.
 *
 *  Returns the connection handle if successful, aborts if not successful.
 *****************************************************************************/
u_int16 UTut_Create_Connection(
    const u_int8 bd_addr[6], u_int16 packet_types,
    u_int8 page_scan_repetition_mode, u_int8 page_scan_mode,
    u_int32 slave_clock_offset_ticks, u_int8 allow_role_switch);

/**************************************************************************
 * UTut_Disconnect_Connection
 *
 * Disconnect the ACL connection based on connection handle
 *
 * connection_handle        ACL connection handle to be disconnected
 *************************************************************************/
t_error UTut_Disconnect_Connection(u_int16 connection_handle);


/* 
 * LINK CONTROL COMMANDS 
 */
void UTut_Send_HCI_Inquiry(u_int32 iac, u_int8 inquiry_length, u_int8 num_responses);
void UTut_Send_HCI_Inquiry_Cancel(void);
void UTut_Send_HCI_Periodic_Inquiry_Mode(u_int16 max_period_length, u_int16 min_period_length,
                                         u_int32 lap, u_int8 inquiry_length, u_int8 num_responses);
void UTut_Send_HCI_Exit_Periodic_Inquiry_Mode(void); 
void UTut_Send_HCI_Create_Connection(const u_int8 bd_addr[6], u_int16 packet_type,
    u_int8 page_scan_repetition_mode, u_int8 page_scan_mode,
    u_int16 clock_offset, u_int8 allow_role_switch);
void UTut_Send_HCI_Create_Connection_Cancel(const u_int8 bd_addr[6]);
void UTut_Send_HCI_Disconnect(u_int16 connection_handle, u_int8 reason);
void UTut_Send_HCI_Add_SCO_Connection(u_int16 connection_handle, u_int16 sco_pkt);
void UTut_Send_HCI_Accept_Connection_Request(const u_int8 bd_addr[6], u_int8 role);
void UTut_Send_HCI_Reject_Connection_Request(const u_int8 bd_addr[6], u_int8 reason);
void UTut_Send_HCI_Link_Key_Request_Reply(const u_int8 bd_addr[6], const u_int8 link_key[16]);
void UTut_Send_HCI_Link_Key_Request_Negative_Reply(const u_int8 bd_addr[6]);
void UTut_Send_HCI_PIN_Code_Request_Reply(const u_int8 bd_addr[6], u_int8 pin_len, const u_int8 pin_code[16]);
void UTut_Send_HCI_PIN_Code_Request_Negative_Reply(const u_int8 bd_addr[6]);
void UTut_Send_HCI_Change_Connection_Packet_Type(
    u_int16 connection_handle, u_int16 packet_types);
void UTut_Send_HCI_Authentication_Requested(u_int16 connection_handle);
void UTut_Send_HCI_Set_Connection_Encryption(u_int16 connection_handle, u_int8 enc_enb);
void UTut_Send_HCI_Change_Connection_Link_Key(u_int16 connection_handle);
void UTut_Send_HCI_Master_Link_Key(u_int8 key_type);
void UTut_Send_HCI_Read_Remote_Name_Request(const u_int8 bd_addr[6],
    u_int8 page_scan_repetition_mode, u_int8 page_scan_mode,
    u_int16 clock_offset);
void UTut_Send_HCI_Read_Remote_Name_Request_Cancel(const u_int8 bd_addr[6]);
void UTut_Send_HCI_Read_Remote_Supported_Features(u_int16 connection_handle);
void UTut_Send_HCI_Read_Remote_Extended_Features(u_int16 connection_handle, u_int8 page_number);
void UTut_Send_HCI_Read_Remote_Version_Information(u_int16 connection_handle);
void UTut_Send_HCI_Read_Clock_Offset(u_int16 connection_handle);
void UTut_Send_HCI_Exchange_Fixed_Info(u_int16 connection_handle);
void UTut_Send_HCI_Exchange_Alias_Info(u_int16 connection_handle, const u_int8 local_alias_bd_addr[6]);
void UTut_Send_HCI_Private_Pairing_Request_Reply(u_int16 connection_handle);
void UTut_Send_HCI_Private_Pairing_Request_Negative_Reply(u_int16 connection_handle);
void UTut_Send_HCI_Generated_Alias(u_int16 connection_handle, const u_int8 alias_bd_addr[6]);
void UTut_Send_HCI_Alias_Address_Request_Reply(const u_int8 bd_addr[6], const u_int8 alias_bd_addr[6]);
void UTut_Send_HCI_Alias_Address_Request_Negative_Reply(const u_int8 bd_addr[6]);
void UTut_Send_HCI_Read_LMP_Handle(u_int16 connection_handle);
void UTut_Send_HCI_Setup_Synchronous_Connection(u_int16 connection_handle, 
    u_int32 transmit_bandwidth, u_int32 receive_bandwidth, u_int16 max_latency,
    u_int16 voice_setting, u_int8 retransmission_effort, u_int16 packet_type);
void UTut_Send_HCI_Accept_Synchronous_Connection_Request(const u_int8* p_bd_addr, 
    u_int32 transmit_bandwidth, u_int32 receive_bandwidth, u_int16 max_latency,
    u_int16 voice_setting, u_int8 retransmission_effort, u_int16 packet_type);
void UTut_Send_HCI_Reject_Synchronous_Connection_Request(const u_int8* p_bd_addr, 
    u_int8 reject_reason);


/*
 * LINK POLICY COMMANDS
 */
void UTut_Send_HCI_Hold_Mode(u_int16 connection_handle,
    u_int16 hold_max_interval,u_int16 hold_min_interval);
void UTut_Send_HCI_Sniff_Mode(u_int16 connection_handle,
    u_int16 sniff_max_interval,u_int16 sniff_min_interval, 
    u_int16 sniff_attempt, u_int16 sniff_timeout);
void UTut_Send_HCI_Exit_Sniff_Mode(u_int16 connection_handle);
void UTut_Send_HCI_Park_Mode(u_int16 connection_handle, 
    u_int16 beacon_max_interval, u_int16 beacon_min_interval);
void UTut_Send_HCI_Exit_Park_Mode(u_int16 connection_handle); 
void UTut_Send_HCI_QoS_Setup(u_int16 connection_handle, u_int8 flags,
    u_int8 service_type, u_int32 token_rate, u_int32 peak_bandwidth,
    u_int32 latency, u_int32 delay_variation);
void UTut_Send_HCI_Role_Discovery(u_int16 connection_handle);
void UTut_Send_HCI_Switch_Role(const u_int8 bd_addr[6], u_int8 new_role );
void UTut_Send_HCI_Read_Link_Policy_Settings(u_int16 connection_handle);
void UTut_Send_HCI_Write_Link_Policy_Settings(u_int16 connection_handle, u_int16 link_policy);
void UTut_Send_HCI_Flow_Specification(u_int16 connection_handle, u_int8 flags,
    u_int8 flow_direction, u_int8 service_type, u_int32 token_rate, u_int32 token_bucket_size,
    u_int32 peak_bandwidth, u_int32 access_latency);
void UTut_Send_HCI_Read_Default_Link_Policy_Settings(void);
void UTut_Send_HCI_Write_Default_Link_Policy_Settings(u_int16 default_link_policy_settings);


/*
 * HOST CONTROLLER AND BASEBAND COMMANDS
 */
void UTut_Send_HCI_Set_Event_Mask(const u_int8 mask[8]);
void UTut_Send_HCI_Reset(void);
void UTut_Send_HCI_Set_Event_Filter(const u_int8 *encoded_filter_settings, u_int8 length);
void UTut_Send_HCI_Set_Event_Filter_Clear_All_Filters(void);
void UTut_Send_HCI_Set_Event_Filter_Connection_All_Devices(u_int8 auto_accept_flag);
void UTut_Send_HCI_Set_Event_Filter_Connection_Specific_BD_ADDR(const u_int8 bd_addr[6], 
    u_int8 auto_accept_flag);
void UTut_Send_HCI_Set_Event_Filter_Connection_Specific_Class_of_Device(u_int32 class_of_device,
    u_int32 class_of_device_mask, u_int8 auto_accept_flag);
void UTut_Send_HCI_Set_Event_Filter_Inquiry_All_Devices(void);
void UTut_Send_HCI_Set_Event_Filter_Inquiry_Specific_BD_ADDR(const u_int8 bd_addr[6]);
void UTut_Send_HCI_Set_Event_Filter_Inquiry_Specific_Class_of_Device(u_int32 class_of_device,
    u_int32 class_of_device_mask);
void UTut_Send_HCI_Flush(u_int16 handle);
void UTut_Send_HCI_Read_PIN_Type(void);
void UTut_Send_HCI_Write_PIN_Type(u_int8 pin_type);
void UTut_Send_HCI_Create_New_Unit_Key(void);
void UTut_Send_HCI_Read_Stored_Link_Key(const u_int8 bd_addr[6], u_int8 read_all_flag);
void UTut_Send_HCI_Write_Stored_Link_Key(int num_keys, u_int8 bd_addrs[][6], u_int8 link_keys[][16]);
void UTut_Send_HCI_Delete_Stored_Link_Key(const u_int8 bd_addr[6], u_int8 delete_all_flag);
void UTut_Send_HCI_Change_Local_Name(const u_int8 *local_name);
void UTut_Send_HCI_Read_Local_Name(void);
void UTut_Send_HCI_Read_Connection_Accept_Timeout(void);
void UTut_Send_HCI_Write_Connection_Accept_Timeout(u_int16 conn_accept_timeout);
void UTut_Send_HCI_Read_Page_Timeout(void);
void UTut_Send_HCI_Write_Page_Timeout(u_int16 page_timeout);
void UTut_Send_HCI_Read_Scan_Enable(void);
void UTut_Send_HCI_Write_Scan_Enable(u_int8 scan_enable);
void UTut_Send_HCI_Read_Page_Scan_Activity(void);
void UTut_Send_HCI_Write_Page_Scan_Activity(u_int16 page_scan_interval, u_int16 page_scan_window);
void UTut_Send_HCI_Read_Inquiry_Scan_Activity(void);
void UTut_Send_HCI_Write_Inquiry_Scan_Activity(u_int16 inquiry_scan_interval, u_int16 inquiry_scan_window);
void UTut_Send_HCI_Read_Authentication_Enable(void);
void UTut_Send_HCI_Write_Authentication_Enable(u_int8 auth_enable_flag);
void UTut_Send_HCI_Read_Encryption_Mode(void);
void UTut_Send_HCI_Write_Encryption_Mode(u_int8 encryption_mode);
void UTut_Send_HCI_Read_Class_Of_Device(void);
void UTut_Send_HCI_Write_Class_Of_Device(u_int32 class_of_device);
void UTut_Send_HCI_Read_Voice_Setting(void);
void UTut_Send_HCI_Write_Voice_Setting(u_int16 voice_settings);
void UTut_Send_HCI_Read_Automatic_Flush_Timeout(u_int16 handle);
void UTut_Send_HCI_Write_Automatic_Flush_Timeout(u_int16 handle, u_int16 timeout);
void UTut_Send_HCI_Read_Num_Broadcast_Retransmissions(void);
void UTut_Send_HCI_Write_Num_Broadcast_Retransmissions(u_int8 num_broadcast_retran);
void UTut_Send_HCI_Read_Hold_Mode_Activity(void);
void UTut_Send_HCI_Write_Hold_Mode_Activity(u_int8 activity);
void UTut_Send_HCI_Read_Transmit_Power_Level(u_int16 connection_handle, u_int8 type);
void UTut_Send_HCI_Read_Synchronous_Flow_Control_Enable(void);
void UTut_Send_HCI_Write_Synchronous_Flow_Control_Enable(u_int8 sco_flow_control_enable);
void UTut_Send_HCI_Set_Host_Controller_To_Host_Flow_Control(u_int8 flow_control_enable);
void UTut_Send_HCI_Host_Buffer_Size(u_int16 acl_data_length, 
    u_int8 sco_data_length, u_int16 num_acl_packets, u_int16 num_sco_packets);
void UTut_Send_HCI_Host_Number_Of_Completed_Packets(u_int8 number_of_handles, 
    const u_int16 connection_handle[], const u_int16 host_num_of_completed_packets[]);
void UTut_Send_HCI_Read_Link_Supervision_Timeout(u_int16 connection_handle);
void UTut_Send_HCI_Write_Link_Supervision_Timeout(
    u_int16 connection_handle, u_int16 supervision_timeout);
void UTut_Send_HCI_Read_Number_Of_Supported_IAC(void);
void UTut_Send_HCI_Read_Current_IAC_LAP(void);
void UTut_Send_HCI_Write_Current_IAC_LAP(u_int8 num_current_iac, const u_int32 iac_lap[]);
void UTut_Send_HCI_Read_Page_Scan_Period_Mode(void);
void UTut_Send_HCI_Write_Page_Scan_Period_Mode(u_int8 page_scan_period_mode);
void UTut_Send_HCI_Read_Page_Scan_Mode(void);
void UTut_Send_HCI_Write_Page_Scan_Mode(u_int8 page_scan_mode);
void UTut_Send_HCI_Read_Inquiry_Scan_Type(void);
void UTut_Send_HCI_Write_Inquiry_Scan_Type(u_int8 scan_type);
void UTut_Send_HCI_Read_Inquiry_Mode(void);
void UTut_Send_HCI_Write_Inquiry_Mode(u_int8 inquiry_mode);
void UTut_Send_HCI_Read_Page_Scan_Type(void);
void UTut_Send_HCI_Write_Page_Scan_Type(u_int8 scan_type);
void UTut_Send_HCI_Set_AFH_Host_Channel_Classification(const u_int8 afh_host_channel_classification[10]);
void UTut_Send_HCI_Read_AFH_Channel_Assessment_Mode(void);
void UTut_Send_HCI_Write_AFH_Channel_Assessment_Mode(u_int8 afh_channel_classification_mode);
void UTut_Send_HCI_Read_Anonymity_Mode(void);
void UTut_Send_HCI_Write_Anonymity_Mode(u_int8 anonymity_mode);
void UTut_Send_HCI_Read_Alias_Authentication_Enable(void);
void UTut_Send_HCI_Write_Alias_Authentication_Enable(u_int8 alias_authentication_enable);
void UTut_Send_HCI_Read_Anonymous_Address_Change_Parameters(void);
void UTut_Send_HCI_Write_Anonymous_Address_Change_Parameters(u_int32 address_update_time,
    u_int16 address_inquiry_period);
void UTut_Send_HCI_Reset_Fixed_Address_Attempts_Counter(u_int8 connection_failure_max);


/*
 * INFORMATIONAL PARAMETER COMMANDS (results returned via command complete).
 */
void UTut_Send_HCI_Read_Local_Version_Information(void);
void UTut_Send_HCI_Read_Local_Supported_Commands(void);
void UTut_Send_HCI_Read_Local_Supported_Features(void);
void UTut_Send_HCI_Read_Buffer_Size(void);
void UTut_Send_HCI_Read_Country_Code(void);
void UTut_Send_HCI_Read_BD_ADDR(void);
void UTut_Send_HCI_Read_Local_Extended_Features(u_int8 page_number);

/*
 * STATUS PARAMETER COMMANDS (OGF 0x05)
 */
void UTut_Send_HCI_Read_Failed_Contact_Counter(u_int16 connection_handle);
void UTut_Send_HCI_Reset_Failed_Contact_Counter(u_int16 connection_handle);
void UTut_Send_HCI_Get_Link_Quality(u_int16 connection_handle);
void UTut_Send_HCI_Read_RSSI(u_int16 connection_handle);
void UTut_Send_HCI_Read_Clock(u_int16 connection_handle, u_int8 which_clock);
void UTut_Send_HCI_Read_AFH_Channel_Map(u_int16 connection_handle);

/*
 * TESTING COMMANDS   (OGF 0x06)
 */
void UTut_Send_HCI_Read_Loopback_Mode(void);
void UTut_Send_HCI_Write_Loopback_Mode(u_int8 loopback_mode);
void UTut_Send_HCI_Enable_Device_Under_Test_Mode(void);

/*
 * PROPRIETARY COMMANDS
 */
void UTut_Send_TCI_Raw_Command(const u_int8* command_buf, u_int32 command_len);

void UTut_Send_TCI_Activate_Remote_DUT(u_int16 conn_handle);
void UTut_Send_TCI_Read_Raw_RSSI(u_int16 conn_handle);
void UTut_Send_TCI_Test_Control(u_int16 conn_handle, 
    u_int8 scenario, u_int8 hop_mode, u_int8 tx_freq,
    u_int8 rx_freq, u_int8 power_control_mode, u_int8 poll_period,
    u_int8 packet_type, u_int16 packet_length, u_int32 system_test_group,
    u_int32 system_test_subgroup, u_int32 test_number);
void UTut_Send_TCI_Increase_Remote_Power(u_int16 conn_handle);
void UTut_Send_TCI_Write_Local_Hop_Frequencies(u_int8 tx_freq, u_int8 rx_freq);
void UTut_Send_TCI_Read_Local_Hop_Frequencies(void);
void UTut_Send_TCI_Read_Local_Hardware_Version(void);
void UTut_Send_TCI_Decrease_Remote_Power(u_int16 conn_handle);
void UTut_Send_TCI_Increase_Local_Volume(void);
void UTut_Send_TCI_Decrease_Local_Volume(void);
void UTut_Send_TCI_Write_Local_Native_Clock(u_int32 clkn);
void UTut_Send_TCI_Read_Local_Native_Clock(void);
void UTut_Send_TCI_Read_Local_Host_Controller_Relative_Mips(void);
void UTut_Send_TCI_Set_Local_Failed_Attempts_Counter(const u_int8 bd_addr[6]);
void UTut_Send_TCI_Clear_Local_Failed_Attempts_Counter(const u_int8 bd_addr[6]);
void UTut_Send_TCI_Read_Local_Default_Packet_Type(void);
void UTut_Send_TCI_Write_Local_Default_Packet_Type(u_int8 packet_type);
void UTut_Send_TCI_Write_Local_Syncword(u_int8 syncword[8]);
void UTut_Send_TCI_Write_Local_Hopping_Mode(u_int8 hopping_mode);
void UTut_Send_TCI_Read_Local_Hopping_Mode(void);
void UTut_Send_TCI_Write_Local_Whitening_Enable(u_int8 whitening_enable);
void UTut_Send_TCI_Read_Local_Whitening_Enable(void);
void UTut_Send_TCI_Write_Local_Radio_Power(u_int16 handle, u_int16 radio_power);
void UTut_Send_TCI_Read_Local_Radio_Power(u_int16 handle);
void UTut_Send_TCI_Set_Local_Next_Available_Am_Addr(u_int8 am_addr);
void UTut_Send_TCI_Set_Local_Bd_Addr(const u_int8 bd_addr[6]);
void UTut_Send_TCI_Write_Local_Link_Key_Type(u_int8 key_type);
void UTut_Send_TCI_Read_Local_Link_Key_Type(void);
void UTut_Send_TCI_Read_Local_Extended_Features(void);
void UTut_Send_TCI_Write_Local_Features(const u_int8 features[8]);
void UTut_Send_TCI_Write_Local_Extended_Features(const u_int8 features[8]);
void UTut_Send_TCI_Read_Local_Timing_Information(void);
void UTut_Send_TCI_Write_Local_Timing_Information(u_int8 drift, u_int8 jitter);
void UTut_Send_TCI_Read_Remote_Timing_Information(u_int16 conn_handle);
void UTut_Send_TCI_Write_Local_Hardware_Register(
    u_int8 jal1_or_hab0, u_int32 address_offset, u_int32 value, u_int32 mask);
void UTut_Send_TCI_Reset_Local_Baseband_Monitors(void);
void UTut_Send_TCI_Change_Radio_Modulation(u_int8 modulate_or_not);
void UTut_Send_TCI_Read_Radio_Modulation(void);
void UTut_Send_TCI_Update_Manufacturing_Information(u_int8 info);
void UTut_Send_TCI_Write_Local_Radio_Register(u_int8 reg_addr, u_int16 reg_val);
void UTut_Send_TCI_Read_Local_Radio_Register(u_int8 reg_addr);
void UTut_Send_TCI_Reset_Local_Pump_Monitors(u_int16 conn_handle);
void UTut_Send_TCI_Read_Local_Pump_Monitors(u_int16 conn_handle);
void UTut_Send_TCI_Write_Local_Encryption_Key_Length(u_int8 key_length);
void UTut_Send_TCI_Read_Local_Encryption_Key_Length(void);
void UTut_Send_TCI_Read_Local_Hop_Frequencies(void);
void UTut_Send_TCI_Read_Local_Baseband_Monitors(void);
void UTut_Send_TCI_Disable_Low_Power_Mode(void);
void UTut_Send_TCI_Enable_Low_Power_Mode(void);
void UTut_Send_TCI_Read_Minimum_R2P_Search_Window(void);
void UTut_Send_TCI_Write_Minimum_R2P_Search_Window(u_int8 win);
void UTut_Send_TCI_Write_HCIT_Uart_Baud_Rate(u_int32 baud_rate);
void UTut_Send_TCI_Read_Unused_Stack_Space(void);
void UTut_Send_TCI_Write_Park_Parameters(u_int8 n_beacon,
    u_int16 d_beacon, u_int8 delta_beacon,
    u_int8 d_access, u_int8 t_access, u_int8 n_b_sleep,
    u_int8 d_b_sleep, u_int8 n_access, u_int8 n_poll,
    u_int8 m_access);
void UTut_Send_TCI_Write_AFH_Control(u_int8 afh_control);
void UTut_Send_TCI_Write_eSCO_Retransmission_Mode(u_int8 esco_retrans_mode);
void UTut_Send_TCI_Read_eSCO_Retransmission_Mode(void);

/*
 * DATA TRANSFER COMMANDS
 */
void UTut_Send_HCI_ACL_Data_Packet(u_int16 handle,
      u_int8 pb_flag, u_int8 bc_flag, u_int8* data_buf, u_int32 data_len);
void UTut_Send_HCI_SCO_Data_Packet(u_int16 handle,
      u_int8* data_buf, u_int32 data_len);

/*
 * EVENTS in order from HCI Specification
 */
boolean UTut_Verify_HCI_Inquiry_Complete_Event(u_int8 status);
boolean UTut_Verify_HCI_Inquiry_Result_Event(u_int8 num_responses, 
    u_int8 bd_addr[][6], const u_int8 page_scan_repitition_mode[], 
    const u_int8 page_scan_period_mode[], const u_int8 page_scan_mode[], 
    const u_int32 class_of_device[], const u_int16 clock_offset[]);
boolean UTut_Verify_HCI_Inquiry_Result_With_RSSI_Event(u_int8 num_responses, 
    u_int8 bd_addr[][6], const u_int8 page_scan_repitition_mode[], 
    const u_int8 page_scan_period_mode[], const u_int32 class_of_device[], 
    const u_int16 clock_offset[], const s_int8 rssi[]);

boolean UTut_Verify_HCI_Connection_Complete_Event(u_int8 status, u_int16 handle,
    const u_int8 bd_addr[6], u_int8 link_type, u_int8 enc_mode);
boolean UTut_Verify_HCI_Connection_Request_Event(
    const u_int8 bd_addr[6], u_int32 class_of_device, u_int8 link_type);
boolean UTut_Verify_HCI_Disconnection_Complete_Event(
    u_int8 status, u_int16 connection_handle, u_int8 reason);
boolean UTut_Verify_HCI_Authentication_Complete_Event(
    u_int8 status, u_int16 connection_handle);
boolean UTut_Verify_HCI_Remote_Name_Request_Complete_Event(
    u_int8 status, const u_int8 bd_addr[6], const u_int8 *remote_name);
boolean UTut_Verify_HCI_Encryption_Change_Event(
    u_int8 status, u_int16 connection_handle, u_int8 enc_enb);
boolean UTut_Verify_HCI_Change_Connection_Link_Key_Complete_Event(
    u_int8 status, u_int16 connection_handle);
boolean UTut_Verify_HCI_Master_Link_Key_Complete_Event(
    u_int8 status, u_int16 connection_handle, u_int8 key_flag);
boolean UTut_Verify_HCI_Read_Remote_Supported_Features_Complete_Event(
    u_int8 status, u_int16 connection_handle, const u_int8 lmp_features[8]);
boolean UTut_Verify_HCI_Read_Remote_Version_Information_Complete_Event(
    u_int8 status, u_int16 connection_handle, u_int8 vers_nr, 
    u_int16 comp_id, u_int16 sub_vers_nr);
boolean UTut_Verify_HCI_QoS_Setup_Complete_Event(u_int8 status, 
    u_int16 connection_handle, u_int8 flags, u_int8 service_type, 
    u_int32 token_rate, u_int32 peak_bandwidth, u_int32 latency, 
    u_int32 delay_variation);
boolean UTut_Verify_HCI_Command_Complete_Event(u_int16 command_opcode,
    const u_int8 *return_parameters, u_int8 length );
boolean UTut_Verify_HCI_Command_Status_Event(u_int8 status, 
    u_int16 command_opcode);
boolean UTut_Verify_HCI_Hardware_Error_Event(u_int8 hardware_error);
boolean UTut_Verify_HCI_Flush_Occurred_Event(u_int16 connection_handle);
boolean UTut_Verify_HCI_Role_Change_Event(
    u_int8 status, const u_int8 bd_addr[6], u_int8 new_role);
boolean UTut_Verify_HCI_Synchronous_Connection_Complete_Event(
    u_int8 status, u_int16 connection_handle, const u_int8 bd_addr[6], 
    u_int8 link_type, u_int8 transmission_interval, 
    u_int8 retransmission_window, u_int16 rx_packet_length, 
    u_int16 tx_packet_length, u_int8 air_mode);
boolean UTut_Verify_HCI_Synchronous_Connection_Changed_Event(
    u_int8 status, u_int16 connection_handle,
    u_int8 transmission_interval, u_int8 retransmission_window, 
    u_int16 rx_packet_length, u_int16 tx_packet_length);
boolean UTut_Verify_HCI_Number_Of_Completed_Packets_Event(
    u_int8 num_of_handles, const u_int16 connection_handles[], 
    const u_int16 hc_num_of_completed_packets[]);
boolean UTut_Verify_HCI_Mode_Change_Event(u_int8 status, 
    u_int16 connection_handle, u_int8 current_mode, u_int16 interval);
boolean UTut_Verify_HCI_Return_Link_Keys_Event(
    u_int8 num_keys, u_int8 bd_addr[][6], u_int8 link_key[][16]);
boolean UTut_Verify_HCI_PIN_Code_Request_Event(const u_int8 bd_addr[6]);
boolean UTut_Verify_HCI_Link_Key_Request_Event(const u_int8 bd_addr[6]);
boolean UTut_Verify_HCI_Link_Key_Notification_Event(
    const u_int8 bd_addr[6], const u_int8 key[16], u_int8 key_type);
boolean UTut_Verify_HCI_Loopback_Command_Event(
    const u_int8 *hci_command_packet, u_int8 length);
boolean UTut_Verify_HCI_Data_Buffer_Overflow_Event(u_int8 link_type);
boolean UTut_Verify_HCI_Max_Slots_Change_Event(
    u_int16 connection_handle, u_int8 lmp_max_slots);
boolean UTut_Verify_HCI_Read_Clock_Offset_Complete_Event(
    u_int8 status, u_int16 connection_handle, u_int16 clock_offset);
boolean UTut_Verify_HCI_Connection_Packet_Type_Changed_Event(
    u_int8 status, u_int16 connection_handle, u_int16 packet_type );
boolean UTut_Verify_HCI_QoS_Violation_Event(u_int16 connection_handle);
boolean UTut_Verify_HCI_Page_Scan_Mode_Change_Event(
    const u_int8 bd_addr[6], u_int8 page_scan_mode);
boolean UTut_Verify_HCI_Page_Scan_Repetition_Mode_Change_Event(
    const u_int8 bd_addr[6], u_int8 page_scan_mode);
boolean UTut_Verify_HCI_Read_Remote_Extended_Features_Complete_Event(
    u_int8 status, u_int16 connection_handle, u_int8 page_number,
    u_int8 maximum_page_number, const u_int8 extended_lmp_features[8]);
boolean UTut_Verify_HCI_Flow_Specification_Complete_Event(
    u_int8 status, u_int16 connection_handle, u_int8 flags, 
    u_int8 flow_direction, u_int8 service_type, u_int32 token_rate,
    u_int32 token_bucket_size, u_int32 peak_bandwidth, u_int32 access_latency);
boolean UTut_Verify_HCI_Fixed_Address_Event(u_int8 status,
    u_int16 connection_handle, const u_int8 fixed_bd_addr[6]);
boolean UTut_Verify_HCI_Alias_Address_Event(u_int16 connection_handle,
    const u_int8 alias_bd_addr[6]);
boolean UTut_Verify_HCI_Generate_Alias_Request_Event(u_int16 connection_handle);
boolean UTut_Verify_HCI_Active_Address_Event(const u_int8 fixed_bd_addr[6],
    const u_int8 active_bd_addr[6]);
boolean UTut_Verify_HCI_Allow_Private_Pairing_Event(u_int16 connection_handle);
boolean UTut_Verify_HCI_Alias_Address_Request_Event(const u_int8 bd_addr[6]);
boolean UTut_Verify_HCI_Alias_Not_Recognised_Event(u_int8 status,
    const u_int8 bd_addr[6]);
boolean UTut_Verify_HCI_Fixed_Address_Attempt_Event(u_int32 reserved);

boolean UTut_Verify_HCI_Raw(u_int8 Q_ID, t_deviceIndex device_index, 
        const u_int8 *raw_data, u_int16 length);

/*
 * PROPRIETARY EVENTS
 */
/* None */

 /*
 * DATA EVENTS
 */
boolean UTut_Verify_HCI_ACL_Data_Packet(t_connectionHandle handle,
      u_int8 pb_flag, u_int8 bc_flag, u_int8* data_buf, u_int32 data_len);
boolean UTut_Verify_HCI_ACL_Data_Packet_Segmented(t_connectionHandle handle,
      u_int8* data_buf, u_int32 data_len, u_int16 segment_size);
boolean UTut_Verify_HCI_SCO_Data_Packet(t_connectionHandle handle,
      u_int8* data_buf, u_int32 data_len);


void UTut_Get_HCI_ACL_Data_Packet(t_connectionHandle handle,
      u_int8 *pb_flag, u_int8 *bc_flag, u_int8* data_buf, u_int32 *data_len);
void UTut_Get_HCI_ACL_Data_Packet_M(t_deviceIndex device_index,
      u_int8 *pb_flag, u_int8 *bc_flag, u_int8* data_buf, u_int32 *data_len);
void UTut_Send_HCI_ACL_Data_Event(u_int16 handle,
      u_int8 pb_flag, u_int8 bc_flag, u_int8* data_buf, u_int32 data_len);
void UTut_Send_HCI_L2CAP_ACL_Data_Start_Packet(u_int16 handle,
      u_int8 pb_flag, u_int8 bc_flag, u_int8* data_buf, u_int16 data_len,u_int16 pdu_len);

/*
 * HELPER FUNCTIONS
 */
boolean UTut_Verify_HCI_Event_Opcode(u_int16 event_opcode);
void UTut_Remove_HCI_Event_Opcode(u_int16 event_opcode);
boolean UTut_Check_If_HCI_Pending_Event(u_int16 event_opcode);
boolean UTut_Get_HCI_Command_Complete_Event_params(u_int16 command_opcode,
        u_int8 *return_parameters, u_int8 length );
boolean UTut_Get_HCI_Connection_Complete_Event_params(u_int8 *status, u_int16 *connection_handle,
    u_int8 *bd_addr, u_int8 *link_type, u_int8 *enc_mode );
boolean UTut_Get_HCI_Command_Status_Event(u_int8 *status, u_int16 *command_opcode);
boolean UTut_Get_HCI_Mode_Change_Event(u_int8 *status, u_int16 *connection_handle, u_int8 *current_mode, u_int16 *interval);
boolean UTut_Get_HCI_Inquiry_Complete_Event(u_int8 *status);
boolean UTut_Get_HCI_Inquiry_Result_Event(u_int8 *num_responses, 
    u_int8 (*bd_addr)[6], 
    u_int8 *page_scan_repitition_mode, u_int8 *page_scan_period_mode, 
    u_int8 *page_scan_mode, u_int32 *class_of_device, u_int16 *clock_offset);
boolean UTut_Get_HCI_Disconnect_Complete_Event(u_int8 *status, u_int16 *connection_handle,
                                               u_int8 *reason);
boolean UTut_Get_HCI_Connection_Packet_Type_Changed_Event(u_int8 *status, u_int16 *connection_handle, u_int16 *packet_type );
boolean UTut_Get_HCI_Max_Slots_Change_Event(u_int8 *lmp_max_slot);
boolean UTut_Get_HCI_Number_Of_Completed_Packets_Event(
    u_int8 *num_handles, u_int16 *connection_handles, u_int16 *completed_packets);
boolean UTut_Verify_HCI_ACL_Data_Packet(t_connectionHandle handle,
    u_int8 pb_flag, u_int8 bc_flag, u_int8* data_buf, u_int32 data_len);
boolean UTut_Verify_HCI_Master_Link_Key_Complete_Event(
    u_int8 status, u_int16 handel, u_int8 key_flag);

boolean UTut_Verify_HCI_Command_Complete_Event_Status_NO_ERROR(u_int16 command_opcode);
boolean UTut_Verify_HCI_Command_Complete_Event_Status(
    u_int16 command_opcode, u_int8 status);
boolean UTut_Verify_HCI_Command_Complete_Event_Special(u_int16 command_opcode); 
boolean UTut_Verify_HCI_Command_Complete_Event_Normal_On_Handle(
    u_int16 command_opcode, u_int16 connection_handle);
boolean UTut_Verify_HCI_Command_Complete_Event__TCI_Read_Local_Baseband_Monitors(
    t_packet pkt_type, u_int32 num_tx_pkts, u_int32 num_rx_pkts);


void UTiut_Verify_No_HCI_Event(u_int16 wait_time);

#if (BUILD_TYPE==RF_TESTER_BUILD)
void print_event(void);
int pprint_event(char *c);
#endif

#endif

